package com.ruoyi.vehicle.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.vehicle.domain.TbHawk;
import com.ruoyi.vehicle.service.ITbHawkService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 强行派单设置Controller
 * 
 * @author ruoyi
 * @date 2025-08-18
 */
@RestController
@RequestMapping("/hawk")
public class TbHawkController extends BaseController
{
    @Autowired
    private ITbHawkService tbHawkService;

    /**
     * 查询强行派单设置列表
     */
    //@RequiresPermissions("vehicle:hawk:list")
    @GetMapping("/list")
    public TableDataInfo list(TbHawk tbHawk)
    {
        startPage();
        List<TbHawk> list = tbHawkService.selectTbHawkList(tbHawk);
        return getDataTable(list);
    }

    /**
     * 导出强行派单设置列表
     */
    //@RequiresPermissions("vehicle:hawk:export")
    @Log(title = "强行派单设置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TbHawk tbHawk)
    {
        List<TbHawk> list = tbHawkService.selectTbHawkList(tbHawk);
        ExcelUtil<TbHawk> util = new ExcelUtil<TbHawk>(TbHawk.class);
        util.exportExcel(response, list, "强行派单设置数据");
    }

    /**
     * 获取强行派单设置详细信息
     */
    //@RequiresPermissions("vehicle:hawk:query")
    @GetMapping(value = "/{hawkId}")
    public AjaxResult getInfo(@PathVariable("hawkId") Long hawkId)
    {
        return success(tbHawkService.selectTbHawkByHawkId(hawkId));
    }

    /**
     * 新增强行派单设置
     */
    //@RequiresPermissions("vehicle:hawk:add")
    @Log(title = "强行派单设置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TbHawk tbHawk)
    {
        return toAjax(tbHawkService.insertTbHawk(tbHawk));
    }

    /**
     * 修改强行派单设置
     */
    //@RequiresPermissions("vehicle:hawk:edit")
    @Log(title = "强行派单设置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TbHawk tbHawk)
    {
        return toAjax(tbHawkService.updateTbHawk(tbHawk));
    }

    /**
     * 删除强行派单设置
     */
    //@RequiresPermissions("vehicle:hawk:remove")
    @Log(title = "强行派单设置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{hawkIds}")
    public AjaxResult remove(@PathVariable Long[] hawkIds)
    {
        return toAjax(tbHawkService.deleteTbHawkByHawkIds(hawkIds));
    }
}
